/*创建更新CUSTOMERS的主键字段CUSTOMER_ID的触发器
触发器与某个表关联后，如果删除相应表，那么触发器也会被删除*/
CREATE OR REPLACE TRIGGER UPDATE_CUSTOMER_ID_TRI BEFORE
INSERT ON CUSTOMERS FOR EACH ROW WHEN(NEW.CUSTOMER_ID IS NULL)
BEGIN
  --查询CUSTOMER_ID_SEQ的下一个值并插入至新的CUSTOMER_ID列中
SELECT CUSTOMER_ID_SEQ.NEXTVAL INTO:NEW.CUSTOMER_ID FROM DUAL;
END;
